package com.qyhl.webtv.module_live.teletext;


import com.qyhl.webtv.commonlib.entity.live.TeleTextBean;

import java.util.List;

/**
 * Created by qyhl on 2017/12/14.
 */

public class TeleTextListPresenter implements TeleTextListContract.TeleTextListPresenter {
    private TeleTextListContract.TeleTextListView mView;

    private TeleTextListModel mModel;

     TeleTextListPresenter(TeleTextListContract.TeleTextListView mView) {
        this.mView = mView;
        this.mModel = new TeleTextListModel(this);
    }

    @Override
    public void getDatas(String sceneId, String type) {
        mModel.getDatas(sceneId, type);
    }

    @Override
    public void checkCode(String sceneId, String code, TeleTextBean bean) {
        mModel.checkCode(sceneId,code,bean);
    }

    @Override
    public void setDatas(List<TeleTextBean> beanList, boolean isMore) {
        mView.setDatas(beanList, isMore);
    }

    @Override
    public void setError(int code, String msg, boolean isMore) {
        switch (code) {
            case 0:
                mView.setNetError(msg, isMore);
                break;
            case 1:
                mView.setError(msg, isMore);
                break;
            case 2:
                mView.setEmpty(msg, isMore);
                break;
            default:
                break;
        }
    }

    @Override
    public void checkResult(boolean isSuccess, TeleTextBean bean) {
        mView.checkResult(isSuccess,bean);
    }
}
